import difflib

f1 = ""
f2 = ""
i=0
e=0

fi = open("file1.txt","r") 
fo = open("file2.txt","r") 


f1 = fi.readlines()
f2 = fo.readlines()

fi.close()
fo.close()

s = difflib.SequenceMatcher(None, f1, f2)

fi = open("diff","w") 

    
for tag in s.get_opcodes():
    if tag[0] == "delete":  
        print str(tag[0]) + " : " + str(f1[tag[1]:tag[2]]) 
    if tag[0]=="insert":
        print str(tag[0]) + " : " + str(f2[tag[3]:tag[4]]) 
    if tag[0] == "replace":
        print str(tag[0]) + " : " + str(f1[tag[1]:tag[2]]) + " con " +  str(f2[tag[3]:tag[4]])
               
fi.close()

     

